#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   app.py
@Time    :   2020/09/29 10:07:02
@Author  :   fengzhilaoling 
@Version :   1.0
@Contact :   fengzhilaoling@163.com
'''
from flask import Flask
from flask_mail import Mail, Message

class config:
    MAIL_SERVER='smtp.126.com'
    MAIL_PORT = 25
    MAIL_USE_TLS = True
    MAIL_USERNAME = 'fengzhilaoling@126.com'
    MAIL_PASSWORD = 'JEGFEUTPRVEPCJLZ'

app = Flask(__name__)
app.config.from_object(config)
mail = Mail(app)
 
msg = Message('标题', sender=config.MAIL_USERNAME, recipients=['fengzhilaoling@163.com'])
msg.body = '内容'
with app.app_context(): # 确认程序上下文被激活
    mail.send(msg)
 
if __name__ == '__main__':
    app.run()
